package com.nm.orm.model;

/**
 * Created by hewu on 2017/2/8 0008.
 */

/**
 * 数据记录状态
 */
public enum State {

    ABLE(1),

    DISABLE(0);

    private int value;

    private State(int value) {
        this.value = value;
    }

    public int dbValue() {
        return this.value;
    }

    public State from(int value) throws Exception {
        for (State state : State.values()) {
            if (value == state.value) {
                return state;
            }
        }
        throw new Exception("未知的状态");
    }

}
